$(function(){
	let pokers = new Pokers();
	    // console.log(pokers.pokers[0]);
	pokers.homePage(pokers);
})

class Pokers {
    constructor() {
        this.points = ['7', 'JOKER', '5', '2', '3', 'A', 'K', 'Q', 'J', '10', '9', '8', '6', '4']; //牌面
        this.types = ['黑桃', '红桃', '梅花', '方块']; //牌色
        this.pokers = []; //扑克牌
        this.size = 0; //牌大小
        this.dir;
        this.decor;
        this.init(); //生成扑克牌
        
      }
      // 初始化牌
    init() {
        // ES6写法
        this.points.forEach((v, i) => {
          // 判断如果是大小王只能由两种颜色
          v == 'JOKER' ? this.types = ['黑桃', '红桃'] : this.types = ['♠', '♥', '♣', '♦']
          this.types.forEach((t, j) => {
            let item = {};
            this.size++;
            item.name = v; //牌名		
            item.size = this.size; //牌大小
            item.decor = t; //牌色
           	item.dir = "\A";
            this.pokers.push(item);

          })
        })
   }
	homePage(pokers){
		var ul = $('.zhu-poker');
		var deg = 0;
		var rotateBeg = "rotate(";
		var content;
		console.log(document.styleSheets[0].cssRules[5]);
		document.styleSheets[0].cssRules[5].style.content = ""
		console.log(document.styleSheets[0].cssRules[5].style.content );	
		//遍历牌
		pokers.pokers.forEach((t,i) => {
			var li = $("<li></li>");
				li.css({
				"transform": rotateBeg+String(deg)+"deg)",
				/*"transition": "1s all",*/
				});
			ul.append(li);
			
			deg+=3;
			// console.log(document.styleSheets[2]);
			content =t.name + "\\A" + t.decor;
			i+=1;
			if(i%2==1){
				//document.styleSheets[0].addRule(".zhu-poker > li:nth-child("+i+"):after","content:'1'");
				//document.styleSheets[0].addRule(".zhu-poker > ul li:nth-child("+i+"):after","color:black");
				//document.styleSheets[0].addRule(".zhu-poker > ul li:nth-child("+i+"):before",'content:"'+content+'"');
				//document.styleSheets[0].addRule(".zhu-poker > ul li:nth-child("+i+"):before","color:black");
			}else{
				//document.styleSheets[1].addRule(".zhu-poker > ul li:nth-child("+i+"):after",'content:"'+content+'"');
				//document.styleSheets[1].addRule(".zhu-poker > ul li:nth-child("+i+"):before",'content:"'+content+'"');
			}
			
			
		})
		
		
		
}
}

   
